﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.UI
{
    public static class ExeServiceManager
    {
        private static List<IExeService> s_services = new List<IExeService>();
        public static void Register(IExeService service)
        {
            s_services.Add(service);
        }

        public static void Release()
        {
            for (int index = 0; index < s_services.Count; index++)
            {
                try
                {
                    s_services[index].Release();
                }
                catch(Exception ex)
                {
                    CPPEI.Coolzon.Common.Logger.ErrorToTag("UI", string.Format("Release exe service at indexs:{0} error,ex:{1}", index, ex));
                }
            }
        }
    }

    public interface IExeService
    {
        void Release();
    }
}
